<template>
	<view class="main">
		<u-navbar :is-back="true" title="消息推送" :background="background" :border-bottom="false" title-color="#fff"
			title-size="35rpx" title-bold="true" back-icon-color="#fff">
		</u-navbar>
		<view class="news" v-for="item,index in list" :key="index" @click="details(item.id)">
			<view class="tit">
				{{item.title}}
			</view>
			<view class="time">
				{{item.create_time}}
			</view>
			<view class="content">
				<text>{{item.descs}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				background: {
					backgroundColor: '#111111',
				},
				limit:10,
				page:1,
				list:[]
			}
		},
		onLoad(){
			this.getdetails()
		},
		methods: {
			details(id){
				uni.navigateTo({
					url:'../newdetails/newdetails',
					success: function(res) {
						res.eventChannel.emit('details', {
							data: {
								id: id,
							}
						})
					}
				})
			},
			getdetails(){
				global.$http.request({
					url:'/api/notice/noticeList',
					data:{
						limit:this.limit,
						page:this.page
					}
				}).then(res=>{
					console.log(res.data.data.list);
					this.list=res.data.data.list
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		font-family: PingFang SC-Bold, PingFang SC;
		background-color: #111111;
		width: 750rpx;

		.main {
			margin-top: 24rpx;
			display: flex;
			flex-direction: column;
			align-items: center;

			.news {
				width: 686rpx;
				background: #181818;
				border-radius: 32rpx;
				opacity: 1;
				padding: 32rpx 24rpx;

				.tit {
					font-size: 32rpx;
					font-weight: bold;
					color: #FFFFFF;
				}

				.time {
					font-size: 24rpx;
					font-weight: 400;
					color: #999999;
					padding: 16rpx 0 28rpx 0;
				}

				.content {
					font-size: 28rpx;
					font-family: PingFang SC-Regular, PingFang SC;
					font-weight: 400;
					color: #FFFFFF;
					line-height: 48rpx;
				}
			}
		}
	}
</style>
